//
//  Common.swift
//  CFZWeiBo
//
//  Created by Cedric Zheng on 24/11/2016.
//  Copyright © 2016 Cedric Zheng. All rights reserved.
//

import UIKit

/// Color for most part of the app, it's orange
let globalColor = UIColor.orange
/// Faded orange color
let globalColorFaded = UIColor(hue: CGFloat(31)/359.0, saturation: 0.7, brightness: 0.95, alpha: 1.0)

/// Bounds of main screen
let mainScreenBounds = UIScreen.main.bounds
/// Width of the screen
let screenWidth = mainScreenBounds.size.width
/// Height of thhe screen
let screenHeight = mainScreenBounds.size.height
/// Scale of thhe screen
let screenScale = UIScreen.main.scale

/// Rulers
let cellRuler   = screenWidth * 0.1
let padding     = cellRuler * 0.3

/// OAuth
let appKey      = "2125054241"
let appSecrect  = "6a28cd046704c4f1a069a46427de289e"
let redirectURI = "https://www.baidu.com"

/// UserDefault
let userStandard = UserDefaults.standard

/// NotificationCenter
let defaultNotiCenter = NotificationCenter.default
/// Should be sent after user login successfully
let loginSuccessNotification = Notification(name: Notification.Name("Login Success"))

/// Version related
/// Indicates that if this launch is user's first time after a version update
let isAppVersionNew: Bool = {
    var isNew = false
    
    let currentVersion = Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
    let oldVersion = userStandard.value(forKey: "Old Version Key") as? String
    
    isNew = oldVersion == nil ? true : oldVersion != currentVersion
    
    userStandard.setValue(currentVersion, forKey: "Old Version Key")
    
    return isNew
}()

/// Date
let dateFormatter = DateFormatter()
//let locale = "zh_Hans_CN"//Chinese (Simplified Han, China)
let locale = Locale(identifier: "en") 
let WeiboDateformatString = "EEE MMM dd HH:mm:ss zzz yyyy"
